#define _CRT_SECURE_NO_WARNINGS 1

#include"My_List.h"

template<typename T>
void print_l(const Btl::list<T>& _list)
{
	typename Btl::list<T>::const_iterator it = _list.begin();
	while (it != _list.end())
	{
		std::cout << *it;
		++it;
	}
	std::cout << std::endl;
}

template<typename Container>
void print_l(const Container& _con)
{
	typename Container::const_iterator it = _con.begin();
	while (it != _con.end())
	{
		std::cout << *it;
		++it;
	}
	std::cout << std::endl;
}

void test_c()
{
	Btl::list<int> l(5, 1);

	print_l(l);

}


void test_empty_c()
{
	Btl::list<int> l;
	l.push_front(3);
	l.push_back(0);
	print_l(l);
}

void test_it_c()
{
	std::string sc("2222222");
	Btl::list<char> l(sc.begin(), sc.end());
	print_l(l);
}

void test()
{
	Btl::list<int> l(3, 4);
	Btl::list<int> _l(l);
	print_l(_l);

	Btl::list<char> _cl(7, '*');
	Btl::list<char> cl(5, 'a');
	std::cout << "cl:";
	print_l(cl);

	cl = _cl;
	std::cout << "cl:";
	print_l(cl);
	std::cout << cl.size();
	cl.push_back('q');
	cl.push_front('s');
	std::cout << cl.front() << " " << cl.back() << std::endl;

	Btl::list<char>::iterator it = cl.begin();

	while (it != cl.end())
	{
		if (*it == '*')
		{
			cl.insert(it, 't');
		}
		++it;
	}
	print_l(cl);


	it = cl.begin();
	while (it != cl.end())
	{
		if (*it == '*')
		{
			it = cl.erase(it);
		}
		else
		{
			++it;
		}
		print_l(cl);

	}
	print_l(cl);
	std::cout << cl.size();
}

void test_()
{
	int array[] = { 1, 2, 3, 4, 0, 5, 6, 7, 8, 9 };
	int n = sizeof(array) / sizeof(int);
	Btl::list<int> mylist(array, array + n);

	auto it = mylist.begin();

	while (it != mylist.end())
	{
		if (*it != 0)
			std::cout << *it << " ";
		else
			it = mylist.erase(it);

		++it;
	}
}

#include<functional>
#include<list>

struct AA
{
	int _a;
};

int main()
{
	//test_c();
	//test_empty_c();
	//test_it_c();
	//test();

	//test_();

	/*std::list<int> lt;
	std::greater<int> gt;*/

	//lt.sort(gt);

	//lt.sort(std::greater<int>());

	Btl::list<AA> la;
	auto it = la.begin();
	it->_a;

	return 0;
}